package UVA;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;

/*
 * @Author Josh Lear
 * @Date 4-15-2014
 * @Problem simple mechanics
 */
public class UVA_11727 {
    public static void main (String[] args) throws IOException {
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
                System.out));
        Scanner sc = new Scanner(System.in);
        int cases = sc.nextInt();
        for (int i = 1; i <= cases; i++) {
            bw.write("Case " + i + ": ");
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            if ((a > b && b > c) || (a < b && b < c)) {
                bw.write(b + "\n");
            } else if ((b > a && a > c) || (b < a && a < c)) {
                bw.write(a + "\n");
            } else {
                bw.write(c + "\n");
            }
        }
        bw.flush();
        sc.close();
    }
}
